package com.scx.controller.voucher;

import com.scx.result.Result;
import com.scx.service.IVoucherOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/voucher-order")
@Api("优惠券秒杀接口")
@Slf4j
public class VoucherOrderController {
    @Autowired
    private IVoucherOrderService voucherOrderService;

    @PostMapping("/seckill/{id}")
    @ApiOperation("优惠券秒杀")
    public Result seckillVoucher(@PathVariable("id") Long voucherId) {
        log.info("优惠券秒杀:{}", voucherId);
        return voucherOrderService.seckillVoucher(voucherId);
    }
}
